﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using MusicExplorer.Resources.Images;

namespace MusicExplorer.Internals
{
    public class FavoriteToStarConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ((bool)value) return Images.GetIcon("FillStar");
            else return Images.GetIcon("UnfillStar");
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class FavoriteAndSelectedToStarConverterVisibility : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool isFavorite = (bool)values[0];
            bool isSelected = (bool)values[1];
            if (isFavorite || (!isFavorite && isSelected)) return Visibility.Visible;
            else return Visibility.Hidden;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
